package org.wangyuhang;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.wangyuhang.service.testService;

import javax.sql.DataSource;

public class jdbcConfig {
@Value("${jdbc.name}")
    private String name;
    @Bean
    public DataSource getDataSource(testService testservice){
//        System.out.println(testservice);
        System.out.println(name);
        testservice.print();
        DruidDataSource dataSource=new DruidDataSource();
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://localhost:3306/test");
        dataSource.setUsername("root");
        dataSource.setPassword("wangyuhang");
        return dataSource;
    }
}
